/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lt.ntec.danblog.server.core.model.objectify;

import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.Query;
import java.util.Map;
import java.util.Set;
import lt.ntec.danblog.server.core.model.Tag;
import lt.ntec.danblog.server.core.model.TagDAO;
import lt.ntec.danblog.server.core.model.Taggable;

/**
 *
 * @author Tadas
 */
class ObjectifyTagDAO  extends ObjectifyBaseDAO<Tag> implements TagDAO  {

    static {
        ObjectifyService.register(ObjectifyTag.class);
    }

    public ObjectifyTagDAO(Objectify ofy){
        super(ofy);
    }

    @Override
    public Tag getTagByValue(String value) {
        Query<? extends Tag> q = ofy.query(getEntityClass()).
                filter("value =", value);
        return q.fetch().iterator().next();
    }

    @Override
    public void deleteParentFromTags(Taggable entity) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Set<? extends Tag> getTagsByParent(Taggable entity) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Tag saveUniqueTag(Tag entity) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Map<Class<?>, Set<Long>> getParentsByTagId(Long id) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Class<? extends Tag> getEntityClass() {
        return ObjectifyTag.class;
    }

}
